Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.4.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.net.ssl
Class HandshakeCompletedEvent

    java.lang.Object
      |
      +--java.util.EventObject
            |
            +--javax.net.ssl.HandshakeCompletedEvent

All Implemented Interfaces:
  Serializable

public class HandshakeCompletedEvent
extends EventObject

This event indicates that an SSL handshake completed on a given SSL connection. All of the core information about that handshake's result is captured through an "SSLSession" object. As a convenience, this event class provides direct access to some important session attributes.

The source of this event is the SSLSocket on which handshaking just completed.

Since:
  1.4
See Also:
  `SSLSocket`, `HandshakeCompletedListener`, `SSLSession`, Serialized Form

Field Summary

Fields inherited from class java.util.EventObject
`source`

Constructor Summary
`HandshakeCompletedEvent(SSLSocket sock, SSLSession s)` Constructs a new HandshakeCompletedEvent.

Method Summary
`String` | `getCipherSuite()` Returns the cipher suite in use by the session which was produced by the handshake.
`Certificate[]` | `getLocalCertificates()` Returns the certificate(s) that were sent to the peer during handshaking.
`X509Certificate[]` | `getPeerCertificateChain()` Returns the identity of the peer which was identified as part of defining the session.
`Certificate[]` | `getPeerCertificates()` Returns the identity of the peer which was established as part of defining the session.
`SSLSession` | `getSession()` Returns the session that triggered this event.
`SSLSocket` | `getSocket()` Returns the socket which is the source of this event.

Methods inherited from class java.util.EventObject
`getSource, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### HandshakeCompletedEvent

    public HandshakeCompletedEvent(SSLSocket sock,
                                   SSLSession s)

  Constructs a new HandshakeCompletedEvent.

Parameters:
  `sock` - the SSLSocket acting as the source of the event
  `s` - the SSLSession this event is associated with

Method Detail

### getSession

    public SSLSession getSession()

  Returns the session that triggered this event.

  Returns:
    the `SSLSession` for this handshake

### getCipherSuite

    public String getCipherSuite()

  Returns the cipher suite in use by the session which was produced by the handshake. (This is a convenience method for getting the ciphersuite from the SSLsession.)

  Returns:
    the name of the cipher suite negotiated during this session.

### getLocalCertificates

    public Certificate[] getLocalCertificates()

  Returns the certificate(s) that were sent to the peer during handshaking. When multiple certificates are available for use in a handshake, the implementation chooses what it considers the "best" certificate chain available, and transmits that to the other side. This method allows the caller to know which certificate chain was actually used.

  Returns:
    an ordered array of certificates, with the local certificate first followed by any certificate authorities. If no certificates were sent, then null is returned.

### getPeerCertificates

    public Certificate[] getPeerCertificates()
                                      throws SSLPeerUnverifiedException

  Returns the identity of the peer which was established as part of defining the session.

  Returns:
    an ordered array of the peer certificates, with the peer's own certificate first followed by any certificate authorities.
  Throws:
    `SSLPeerUnverifiedException` - if the peer is not verified.

### getPeerCertificateChain

    public X509Certificate[] getPeerCertificateChain()
                                              throws SSLPeerUnverifiedException

  Returns the identity of the peer which was identified as part of defining the session.

  Note: this method exists for compatibility with previous releases. New applications should use `getPeerCertificates()` instead.

  Returns:
    an ordered array of peer X.509 certificates, with the peer's own certificate first followed by any certificate authorities. (The certificates are in the original JSSE `X509Certificate` format).
  Throws:
    `SSLPeerUnverifiedException` - if the peer is not verified.

### getSocket

    public SSLSocket getSocket()

  Returns the socket which is the source of this event. (This is a convenience function, to let applications write code without type casts.)

  Returns:
    the socket on which the connection was made.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.4.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.